using System.IO;
using Jurassic.Library;
using Kiwi.Node.Utility;

namespace Kiwi.Node.Modules.Builtin
{
    public class TextFile: BuiltinModuleObject
    {
        public TextFile(IApplication application) : base(application)
        {
        }

        [JSFunction(Name = "read")]
        public string Read(string path)
        {
            return File.ReadAllText(PathHelper.ResolvePath(Application.RootFolder, path, ".txt", ".html", ".html"));
        }
    }
}